user {{NGINX_USER}} {{NGINX_GROUP}};
worker_processes  1;

#error_log  {{nginx_log_path}}/error.log;
#error_log /dev/null;
#pid        {{nginx_log_path}}/nginx.pid;

events {
    use epoll;
    worker_connections 65535;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    log_format main '$remote_addr##-##$remote_user##[$time_local]##"$request"##'
    '$status##$body_bytes_sent##"$http_referer"##'
    '"$http_user_agent"##$request_time##$http_host##$http_x_forwarded_for##$upstream_addr##$upstream_status##$scheme##$upstream_response_time';

#    access_log {{nginx_log_path}}/access.log main;

    server_names_hash_bucket_size 128;
    client_max_body_size 500m;
    client_body_buffer_size 500m;
    sendfile on;
    tcp_nopush on;
    underscores_in_headers on;

    keepalive_timeout 120;
    tcp_nodelay on;
    server_tokens off;
    gzip on;
    gzip_min_length 1k;
    gzip_buffers 4 16k;
    gzip_http_version 1.1;
    gzip_comp_level 9;
    gzip_types text/plain application/x-javascript application/json text/css text/javascript application/x-httpd-php image/jpeg image/gif image/png application/javascript;
    gzip_vary on;

    proxy_http_version 1.1;
    proxy_set_header Connection "";
## to avoid error: upstream sent too big header while reading response header from upstream
    proxy_buffer_size  128k;
    proxy_buffers   32 32k;
    proxy_busy_buffers_size 128k;

    map $http_upgrade $connection_upgrade {
	   default upgrade;
	     '' close;
  	}

    proxy_intercept_errors on;
    error_page 404 /res/error/404.html;
    error_page 500 502 503 504 /res/error/500.html;

    proxy_set_header Host $host;
    proxy_set_header x-request-rid $request_id;

	  include servers/*.conf;
}

#stream {
#    include {{nginx_stream_conf_path}}/*.conf;
#}

